package com.lyc.wanandroid_kotlin.ui.activity.login.mvp.presenter

import com.lyc.wanandroid_kotlin.base.BasePresenter
import com.lyc.wanandroid_kotlin.ui.activity.login.mvp.contract.RegisterContract
import com.lyc.wanandroid_kotlin.ui.activity.login.mvp.model.RegisterModel
import ss

/**
 * ClassName:com.lyc.wanandroid_kotlin.ui.activity.login.mvp.presenter
 * Description:
 */
class RegisterPresenter : BasePresenter<RegisterContract.Model, RegisterContract.View>(),
    RegisterContract.Presenter {


    override fun createModel(): RegisterContract.Model? = RegisterModel()


    override fun registerWanAndroid(username: String, password: String, repassword: String) {
        mModel?.registerWanAndroid(username, password, repassword)?.ss(mModel, mView) {
            mView?.apply {
                if (it.errorCode!=0){
                    registerFail()
                }else{
                    registerSuccess(it.data)
                }
            }
        }
    }
}